extends Node2D

var up_origin_pos
var down_origin_pos
var ani_time=0.5
var show_level_time=1

func _ready():
	up_origin_pos=$Up.position
	down_origin_pos=$Down.position
	self.show()

func show_ani():
	$Label.text="S T A G E "+str( get_tree().current_scene.level_num)
	$Tween.interpolate_property($Up,"position",up_origin_pos,Vector2(0,0),ani_time)
	$Tween.interpolate_property($Down,"position",down_origin_pos,Vector2(0,$Down.texture.get_height()),ani_time)
	$Tween.interpolate_callback(self,show_level_time+ani_time,"_black_and_label_hide")
	$Tween.interpolate_property($Up,"position",Vector2(0,0),up_origin_pos,ani_time,Tween.TRANS_LINEAR,Tween.EASE_IN,show_level_time+ani_time)
	$Tween.interpolate_property($Down,"position",Vector2(0,$Down.texture.get_height()),down_origin_pos,ani_time,Tween.TRANS_LINEAR,Tween.EASE_IN,show_level_time+ani_time)
	$Tween.start()

func _black_and_label_hide():
	$Black.hide()
	$Label.hide()

func _on_tween_all_completed():
	get_tree().current_scene.level_start()
	pass # Replace with function body.
